package com.ruoyi.param.service.impl;

import com.ruoyi.param.domain.TparamTm;
import com.ruoyi.param.mapper.TparamTmMapper;
import com.ruoyi.param.service.ITparamTmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ITparamTmServiceImpl implements ITparamTmService {

    @Autowired
    private TparamTmMapper tparamTmMapper;

    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @Override
    public List<TparamTm> selectTmList(TparamTm record) {
        return tparamTmMapper.selectTmList(record);
    }

    @Override
    public void updateByRoomIdSelective(TparamTm record) {
        threadPoolTaskExecutor.execute(() -> tparamTmMapper.updateByRoomIdSelective(record));
    }

    @Override
    public List<TparamTm> selectByRoomId(String roomId) {
        return tparamTmMapper.selectByRoomId(roomId);
    }

    @Override
    public void deleteByRoomIds(List<String> roomIds) {
        tparamTmMapper.deleteByRoomIds(roomIds);
    }

    @Override
    public void refresh(List<TparamTm> records) {
        if (!records.isEmpty()) {
            tparamTmMapper.refresh(records);
        }
    }

    @Override
    public void insertSelective(TparamTm record) {
        tparamTmMapper.insertSelective(record);
    }
}
